<%@ page contentType="text/html;charset=ISO8859_1" language="java" %>

<%@ taglib uri="/WEB-INF/tld/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/tld/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/tld/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/tld/struts-nested.tld" prefix="nested" %>

<jsp:useBean id="PageTunerForm" type="org.apache.struts.validator.DynaValidatorForm" scope="request" />
<% request.setAttribute("request", request); %>
<bean:parameter id="oAddFunc" name="ctrl" />

<html:html locale="true">
<head>
	<title><bean:message key="auth.roleSelector.title" /></title>
	<link rel="stylesheet" href="../style/default_aux.css" id="oCssLink">
	<script language="javascript" src="../script/pagetuner.js"></script>
	<script>
		var vRoleid = new Array(0);
		var vLabel = new Array(0);
	</script>
</head>
<body onload="oninit()">
	<script src="/script/overlib.js" language="JavaScript"></script>
	<script src="/script/windows.js" language="JavaScript"></script>
	<table cellspacing="0" class="filledframe">
		<tr>
			<td nowrap="" class="clientframe">
				<html:form action="/auth/RoleSelector" styleId="oListForm">
					<input type="hidden" name="ctrl" value="<bean:write name="oAddFunc" />" >
					<table id="oHelp" class="helper" >
						<tr>
							<td width="150" class="label"><bean:message key="common.keywordSearchPrompt" /></td>
							<td width="36" class="action"><input type="text" size="16" name="keyword" class="text" value="<%=(null == request.getParameter("keyword") ? "" : request.getParameter("keyword"))%>" ></td>
							<td width="36" class="action"><input type="submit" class="button" value="<bean:message key="common.search" />" ></td>
							<td class="help"><input type="button" class="button" title="<bean:message key="common.help.title" />" onclick="help('help.report.schd');" value="<bean:message key="common.help" />" ></td>
						</tr>
					</table>
					<logic:notEmpty name="PageTunerForm" property="sortIndexes">
						<logic:iterate id="element" name="PageTunerForm" property="sortIndexes">
							<input type="hidden" name="sortIndexes" value="<bean:write name="element" />" />
						</logic:iterate> 
					</logic:notEmpty>
					<html:hidden property="pageIndex" value="0" />
					<div class="listtitle"><bean:message key="auth.roleSelector.title" /></div>
					<!-- div class="subtitle">&nbsp;</div -->
				
					<table class="tabheader" width="90%" >
						<tr id="oToolBar">
							<td align="left" nowrap=""><bean:message key="common.page" 
								arg0="<%=String.valueOf(PageTunerForm.get("pageIndex"))%>"
								arg1="<%=String.valueOf(PageTunerForm.get("totalPages"))%>"
								arg2="<%=String.valueOf(PageTunerForm.get("totalRows"))%>" /></td>
							<td align="left" nowrap="">&nbsp;</td>
							<td align="right" width="3%" nowrap=""><a href="javascript: window.print(); "><html:img src="/images/prints.gif" altKey="common.print" titleKey="common.pageprint.title" /></a></td>
						</tr>
					</table>
					
					<table id="oCube" width="90%" cellspacing="0" class="listpanel">
						<tr class="layer00">
							<td class="typel" width="32" nowrap >&nbsp;</td>
							<td class="type" nowrap colspan="2" ><a href="javascript:sortBy(oListForm, 1)"><bean:message key="inforole.roleid" /></a> <script>drawSortFlag(oListForm, 1)</script></td>
							<td class="type" width="60" nowrap ><a href="javascript:sortBy(oListForm, 2)"><bean:message key="inforole.rolelabel" /></a> <script>drawSortFlag(oListForm, 2)</script></td>
							<td class="typer" nowrap ><a href="javascript:sortBy(oListForm, 3)"><bean:message key="inforole.roledesc" /></a> <script>drawSortFlag(oListForm, 3)</script></td>
						</tr>
						<logic:iterate id="element" name="listResult">
						<script>
							vRoleid[vRoleid.length] = '<bean:write name="element" property="roleid" />';
							vLabel[vLabel.length] = '<bean:write name="element" property="rolelabel" />';
						</script>
						<tr class="layer<bean:write name="element" property="style" />">
							<td class="ctrl" nowrap ><input type="checkbox" name="roleid" value="<bean:write name="element" property="roleid" />" ></td>
							<td class="type0" nowrap width="16" ><img src="/images/roles<bean:write name="element" property="statuscode" />.gif" ></td>
							<td class="type0" nowrap width="60" ><bean:write name="element" property="roleid" /></td>
							<td class="type0" nowrap ><bean:write name="element" property="rolelabel" /></td>
							<td class="type0" nowrap ><bean:write name="element" property="roledesc" /></td></tr>
						</logic:iterate>
					</table>
					<table class="tabfooter" width="90%" >
						<tr>
							<td align="left" width="5%" nowrap=""><input type="button" class="button" onclick="onOk(); " value="<bean:message key="common.ok" />" ></td>
							<td align="left" nowrap=""></td>
							<td align="right" width="30%" nowrap="" id="oPageNavigator"></td>
							<td align="right" width="5%" nowrap=""> <bean:message key="common.rowsperpage.prefix" /></td>
							<td align="right" width="2%" nowrap=""><html:text property="rowsPerPage" size="2" /></td>
							<td align="right" width="5%" nowrap=""><bean:message key="common.rowsperpage.postfix" /></td>
						</tr>
					</table>
				</html:form>
			</td>
			<!-- td id="oFrame" nowrap="" class="infoframe" rowspan="2">&nbsp;</td -->
		</tr>
		<tr>
			<td class="clientfooter"><bean:message key="common.lastRefreshAt" arg0="<%=new java.util.Date().toString()%>" /></td>
		</tr>
	</table>
<script language="javascript">
	
function oninit()
{
	var nTotalPages = <bean:write name="PageTunerForm" property="totalPages" />;
	var nPageIndex = <bean:write name="PageTunerForm" property="pageIndex" />;
	
	addPageTuner(oToolBar, oListForm.pageIndex, nPageIndex, nTotalPages);
	addPageNavigator(oPageNavigator, oListForm.pageIndex, nPageIndex, nTotalPages);
}
function onOk()
{
	var vChecked = getCheckValues(oListForm.roleid);
	
	var i;
	var c = 0;
	for (i = 0; i < vRoleid.length; ++i)
	{
		if (vChecked[c] == vRoleid[i])
		{
			opener.<bean:write name="oAddFunc" />(new Array(vRoleid[i], vLabel[i]));
			++c;
		}
	}
	
	window.close();
}
</script>
<script for="window" event="onbeforeprint">document.all.oCssLink.href = "../style/default_auxp.css";</script>
<script for="window" event="onafterprint">document.all.oCssLink.href = "../style/default_aux.css";</script>
</body>
</html:html>










